package com.ktgj.hotel.service.impl;

import java.util.ArrayList;
import java.util.List;

import com.alibaba.druid.sql.visitor.functions.If;
import com.ktgj.common.core.annotation.Excel;
import com.ktgj.common.core.enums.HotelEnum;
import com.ktgj.hotel.domain.*;
import com.ktgj.hotel.domain.dic.DicCounty;
import com.ktgj.hotel.domain.vo.DicPositionLabelVo;
import com.ktgj.hotel.domain.vo.FilterConditionVo;
import com.ktgj.hotel.domain.vo.RegionalLocationVo;
import com.ktgj.hotel.mapper.*;
import com.ktgj.hotel.utils.GaoDeUtil;
import jdk.nashorn.internal.runtime.linker.LinkerCallSite;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ktgj.hotel.service.IDicPositionLabelService;
import org.springframework.web.bind.annotation.PatchMapping;

/**
 * 【请填写功能名称】Service业务层处理
 * 
 * @author ruoyi
 * @date 2021-12-09
 */
@Service
public class DicPositionLabelServiceImpl implements IDicPositionLabelService 
{
    @Autowired
    private DicPositionLabelMapper dicPositionLabelMapper;

    @Autowired
    private DicLankMarkMapper dicLankMarkMapper;

    @Autowired
    private DicCircleMapper dicCircleMapper;

    @Autowired
    private DicAirportStationMapper dicAirportStationMapper;

    @Autowired
    private DicCountyMapper dicCountyMapper;

    @Autowired
    private DicSubwayMapper dicSubwayMapper;

    @Autowired
    private DicSubwayStationMapper dicSubwayStationMapper;

    @Autowired
    private DicHotPositionMapper dicHotPositionMapper;

    @Autowired
    private DicCommonFacilitiesMapper dicCommonFacilitiesMapper;

    @Autowired
    private DicCityMapper dicCityMapper;

    @Autowired
    private DicThemsMapper dicThemsMapper;

    @Autowired
    private DicDistanceMapper dicDistanceMapper;

    @Autowired
    private DicReviewsMapper dicReviewsMapper;

    @Autowired
    private DicHotelTypeMapper dicHotelTypeMapper;

    @Autowired
    private DicRoomTypeBreakastMapper dicRoomTypeBreakastMapper;

    /**
     * 查询【请填写功能名称】
     * 
     * @param id 【请填写功能名称】ID
     * @return 【请填写功能名称】
     */
    @Override
    public DicPositionLabel selectDicPositionLabelById(Long id)
    {
        return dicPositionLabelMapper.selectDicPositionLabelById(id);
    }

    /**
     * 查询【请填写功能名称】列表
     * 
     * @param dicPositionLabel 【请填写功能名称】
     * @return 【请填写功能名称】
     */
    @Override
    public List<DicPositionLabel> selectDicPositionLabelList(DicPositionLabel dicPositionLabel)
    {
        return dicPositionLabelMapper.selectDicPositionLabelList(dicPositionLabel);
    }

    /**
     * 新增【请填写功能名称】
     * 
     * @param dicPositionLabel 【请填写功能名称】
     * @return 结果
     */
    @Override
    public int insertDicPositionLabel(DicPositionLabel dicPositionLabel)
    {
        return dicPositionLabelMapper.insertDicPositionLabel(dicPositionLabel);
    }

    /**
     * 修改【请填写功能名称】
     * 
     * @param dicPositionLabel 【请填写功能名称】
     * @return 结果
     */
    @Override
    public int updateDicPositionLabel(DicPositionLabel dicPositionLabel)
    {
        return dicPositionLabelMapper.updateDicPositionLabel(dicPositionLabel);
    }

    /**
     * 批量删除【请填写功能名称】
     * 
     * @param ids 需要删除的【请填写功能名称】ID
     * @return 结果
     */
    @Override
    public int deleteDicPositionLabelByIds(Long[] ids)
    {
        return dicPositionLabelMapper.deleteDicPositionLabelByIds(ids);
    }

    /**
     * 删除【请填写功能名称】信息
     * 
     * @param id 【请填写功能名称】ID
     * @return 结果
     */
    @Override
    public int deleteDicPositionLabelById(Long id)
    {
        return dicPositionLabelMapper.deleteDicPositionLabelById(id);
    }

    /**
     * 查询酒店区域位置筛选条件
     * */
    @Override
    public List<DicPositionLabelVo> filterCondition(Long cityCountyId, String lng, String lat) throws Exception {
        if (cityCountyId == null || cityCountyId == 0 || cityCountyId.equals(null)){
            if (lng != null && !lng.equals("") && lat != null && !lat.equals("")){
                String cityName = cityName(lng, lat);
                cityCountyId = dicCityMapper.cityId(cityName + "%");
            }
        }

            List<DicPositionLabelVo> dicPositionLabelVoList = new ArrayList<>();

            List<DicPositionLabel> positionLabelList = dicPositionLabelMapper.filterCondition();
            if (positionLabelList != null){
                for (DicPositionLabel dicPositionLabel : positionLabelList) {
                    if (dicPositionLabel.getIsValid() != 0){
                        DicPositionLabelVo dicPositionLabelVo = new DicPositionLabelVo();
                        if (dicPositionLabel.getIsValid() == 1 && dicPositionLabel.getType().equals("area")){//去除未启用的地区类标题

                            dicPositionLabelVo.setAreaConditionId(dicPositionLabel.getId());
                            String areaType = areaType(dicPositionLabel.getLabelName());
                            if (areaType == null || areaType.equals("") || areaType.equals(null) || areaType == ""){
                                throw new Exception("未获取到"+dicPositionLabel.getLabelName()+"的地区条件类型");
                            }
                            dicPositionLabelVo.setAreaConditionType(areaType);
                            dicPositionLabelVo.setAreaConditionName(dicPositionLabel.getLabelName());

                            List<RegionalLocationVo> regionalLocationVos = regionalLocationVoList(areaType, cityCountyId);

                            dicPositionLabelVo.setRegionalLocationVoList(regionalLocationVos);
                            dicPositionLabelVoList.add(dicPositionLabelVo);
                        }
                    }
                }
                return dicPositionLabelVoList;
            }
            else {
                return null;
            }
    }

    /**
     * 查询酒店区域位置筛选条件(小程序)
     * */
    @Override
    public List<DicPositionLabelVo> condition(String cityCountyName, String lng, String lat) throws Exception {
        Long cityCountyId = null;
        if (cityCountyName != null && !cityCountyName.equals("")){
            cityCountyId = dicCityMapper.cityId(cityCountyName + "%");
        }
        if (cityCountyId != null || (lng != null && !lng.equals("") && lat != null && !lat.equals(""))){
            List<DicPositionLabelVo> dicPositionLabelVoList = filterCondition(cityCountyId, lng, lat);
            if (dicPositionLabelVoList != null && dicPositionLabelVoList.size() > 0){
                return dicPositionLabelVoList;
            }
            else {
                throw new Exception("未查到对应数据");
            }
        }
        else {
            throw new Exception("参数错误");
        }
    }

    /**
     * 查询酒店筛选筛选条件
     * */
    @Override
    public List<DicPositionLabelVo> filter() throws Exception {
            List<DicPositionLabelVo> dicPositionLabelVoList = new ArrayList<>();

            List<DicPositionLabel> positionLabelList = dicPositionLabelMapper.filterCondition();
            if (positionLabelList != null){
                for (DicPositionLabel dicPositionLabel : positionLabelList) {
                    DicPositionLabelVo dicPositionLabelVo = new DicPositionLabelVo();
                    if (dicPositionLabel.getIsValid() == 1 && dicPositionLabel.getType().equals("filter")){//去除未启用的非地区类标题

                        dicPositionLabelVo.setAreaConditionId(dicPositionLabel.getId());
                        dicPositionLabelVo.setAreaConditionName(dicPositionLabel.getLabelName());

                        String areaType = areaType(dicPositionLabel.getLabelName());
                        if (areaType == null || areaType.equals("") || areaType.equals(null) || areaType == ""){
                            throw new Exception("未获取到"+dicPositionLabel.getLabelName()+"的筛选条件类型");
                        }
                        List<RegionalLocationVo> regionalLocationVoList = regionalLocationVoList(areaType, 1l);

                        dicPositionLabelVo.setRegionalLocationVoList(regionalLocationVoList);
                        dicPositionLabelVoList.add(dicPositionLabelVo);
                    }
                }
                return dicPositionLabelVoList;
            }
            else {
                return null;
            }
    }

    /**
     * 根据经纬度获取所在城市(高德)调用方法
     * */
    public String cityName(String lng, String lat){
        //拼接经纬度
        String lngAndLat=lng+","+lat;

        //调用方法查询城市名称
        GaoDeUtil deUtil = new GaoDeUtil();
        String cityName=deUtil.getCityByCoordinate(lngAndLat);
        return cityName;
    }

    /**
     * 获取地区条件类型
     * */
    public String areaType(String areaName){
        String areaType = null;
        if (areaName != null && !areaName.equals("")){
            switch (areaName){
                case "行政区":
                    areaType = HotelEnum.RegionalLocation.administrativeDistrict.getValue();
                    break;
                case "商圈":
                    areaType = HotelEnum.RegionalLocation.businessDistrict.getValue();
                    break;
                case "机场/车站":
                    areaType = HotelEnum.RegionalLocation.airportStation.getValue();
                    break;
                case "地铁站":
                    areaType = HotelEnum.RegionalLocation.subwayStation.getValue();
                    break;
                case "医院":
                    areaType = HotelEnum.RegionalLocation.hospital.getValue();
                    break;
                case "距离":
                    areaType = HotelEnum.RegionalLocation.distance.getValue();
                    break;
                case "热门区域":
                    areaType = HotelEnum.RegionalLocation.popularArea.getValue();
                    break;

                case "服务设施":
                    areaType = HotelEnum.RegionalLocation.serviceFacilities.getValue();
                    break;
                case "点评":
                    areaType = HotelEnum.RegionalLocation.reviews.getValue();
                    break;
                case "酒店类型":
                    areaType = HotelEnum.RegionalLocation.hotelType.getValue();
                    break;
                case "特色主题":
                    areaType = HotelEnum.RegionalLocation.featuredTopics.getValue();
                    break;
                case "房型早餐":
                    areaType = HotelEnum.RegionalLocation.roomTypeBreakfast.getValue();
                    break;
            }
        }
        return areaType;
    }

    /**
     * 获取筛选条件信息
     * */
    public List<RegionalLocationVo> regionalLocationVoList(String areaType, Long cityCountyId) throws Exception {
        List<RegionalLocationVo> regionalLocationVoList = new ArrayList<>();

        if (cityCountyId != null && cityCountyId != 0){
            switch (areaType){
                case "administrativeDistrict"://行政区
                    List<DicCounty> dicCountieList;
                    try {
                        dicCountieList = dicCountyMapper.conditionAdministrativeDistrict(cityCountyId);
                    } catch (Exception e){
                        throw new Exception("行政区查询失败");
                    }
                    if (dicCountieList != null && dicCountieList.size() > 0){
                        RegionalLocationVo regionalLocation = new RegionalLocationVo();
                        regionalLocation.setFilterConditionId(999l);
                        regionalLocation.setFilterConditionName("不限");
                        regionalLocationVoList.add(regionalLocation);
                        for (DicCounty dicCounty : dicCountieList) {
                            RegionalLocationVo regionalLocationVo = new RegionalLocationVo();
                            regionalLocationVo.setFilterConditionId(dicCounty.getId());
                            regionalLocationVo.setFilterConditionName(dicCounty.getCountyName());
                            regionalLocationVoList.add(regionalLocationVo);
                        }
                    }
                    else {
                        throw new Exception("行政区信息为空");
                    }
                    break;

                case "businessDistrict"://商圈
                    List<DicCircle> dicCircleList;
                    try {
                        dicCircleList = dicCircleMapper.dicCircleList(cityCountyId);
                    } catch (Exception e){
                        throw new Exception("商圈查询失败");
                    }
                    if (dicCircleList != null && dicCircleList.size() > 0){
                        RegionalLocationVo regionalLocation = new RegionalLocationVo();
                        regionalLocation.setFilterConditionId(999l);
                        regionalLocation.setFilterConditionName("不限");
                        regionalLocationVoList.add(regionalLocation);
                        for (DicCircle dicCircle : dicCircleList) {
                            RegionalLocationVo regionalLocationVo = new RegionalLocationVo();
                            regionalLocationVo.setFilterConditionId(dicCircle.getId());
                            regionalLocationVo.setFilterConditionName(dicCircle.getCircleName());
                            regionalLocationVoList.add(regionalLocationVo);
                        }
                    }
                    else {
                        throw new Exception("商圈信息为空");
                    }
                    break;

                case "airportStation"://机场/车站
                    List<DicAirportStation> airportList;//机场
                    List<DicAirportStation> trainList;//火车
                    List<DicAirportStation> carList;//汽车
                    try {
                        airportList = dicAirportStationMapper.dicAirportStationList(cityCountyId, 1l);
                        trainList = dicAirportStationMapper.dicAirportStationList(cityCountyId, 2l);
                        carList = dicAirportStationMapper.dicAirportStationList(cityCountyId, 3l);
                    } catch (Exception e){
                        throw new Exception("机场/车站查询失败");
                    }

                    if (airportList != null && airportList.size() > 0){
                        RegionalLocationVo regionalLocationVo = new RegionalLocationVo();
                        regionalLocationVo.setFilterConditionId(1l);
                        regionalLocationVo.setFilterConditionName("机场");
                        List<FilterConditionVo> filterConditionVoList = new ArrayList<>();
                        FilterConditionVo filterCondition = new FilterConditionVo();
                        filterCondition.setSubwayId(999l);
                        filterCondition.setSubwayName("不限");
                        filterConditionVoList.add(filterCondition);
                        for (DicAirportStation airport : airportList) {
                            FilterConditionVo filterConditionVo = new FilterConditionVo();
                            filterConditionVo.setSubwayId(airport.getId());
                            filterConditionVo.setSubwayName(airport.getAirportStationName());
                            filterConditionVoList.add(filterConditionVo);
                        }
                        regionalLocationVo.setFilterCondition(filterConditionVoList);
                        regionalLocationVoList.add(regionalLocationVo);
                    }
                    else {
                        throw new Exception("机场信息为空");
                    }

                    if (trainList != null && trainList.size() > 0){
                        RegionalLocationVo regionalLocationVo = new RegionalLocationVo();
                        regionalLocationVo.setFilterConditionId(2l);
                        regionalLocationVo.setFilterConditionName("火车站");
                        List<FilterConditionVo> filterConditionVoList = new ArrayList<>();
                        FilterConditionVo filterCondition = new FilterConditionVo();
                        filterCondition.setSubwayId(999l);
                        filterCondition.setSubwayName("不限");
                        filterConditionVoList.add(filterCondition);
                        for (DicAirportStation train : trainList) {
                            FilterConditionVo filterConditionVo = new FilterConditionVo();
                            filterConditionVo.setSubwayId(train.getId());
                            filterConditionVo.setSubwayName(train.getAirportStationName());
                            filterConditionVoList.add(filterConditionVo);
                        }
                        regionalLocationVo.setFilterCondition(filterConditionVoList);
                        regionalLocationVoList.add(regionalLocationVo);
                    }
                    else {
                        throw new Exception("火车站信息为空");
                    }

                    if (carList != null && carList.size() > 0){
                        RegionalLocationVo regionalLocationVo = new RegionalLocationVo();
                        regionalLocationVo.setFilterConditionId(3l);
                        regionalLocationVo.setFilterConditionName("汽车站");
                        List<FilterConditionVo> filterConditionVoList = new ArrayList<>();
                        FilterConditionVo filterCondition = new FilterConditionVo();
                        filterCondition.setSubwayId(999l);
                        filterCondition.setSubwayName("不限");
                        filterConditionVoList.add(filterCondition);
                        for (DicAirportStation car : carList) {
                            FilterConditionVo filterConditionVo = new FilterConditionVo();
                            filterConditionVo.setSubwayId(car.getId());
                            filterConditionVo.setSubwayName(car.getAirportStationName());
                            filterConditionVoList.add(filterConditionVo);
                        }
                        regionalLocationVo.setFilterCondition(filterConditionVoList);
                        regionalLocationVoList.add(regionalLocationVo);
                    }
                    else {
                        throw new Exception("汽车站信息为空");
                    }
                    break;

                case "subwayStation"://地铁站
                    List<DicSubway> dicSubwayList;
                    try {
                        dicSubwayList = dicSubwayMapper.conditionSubwayline(cityCountyId);
                    } catch (Exception e){
                        throw new Exception("地铁线路查询失败");
                    }
                    if (dicSubwayList != null && dicSubwayList.size() > 0){
                        for (DicSubway dicSubway : dicSubwayList) {
                            RegionalLocationVo regionalLocationVo = new RegionalLocationVo();
                            regionalLocationVo.setFilterConditionId(dicSubway.getId());
                            regionalLocationVo.setFilterConditionName(dicSubway.getSubwayName());

                            List<DicSubwayStation> subwayStationList;
                            try{
                                subwayStationList = dicSubwayStationMapper.conditionSubway(dicSubway.getId());
                            } catch (Exception e){
                                throw new Exception(dicSubway.getSubwayName()+"站点查询失败");
                            }
                            List<FilterConditionVo> filterConditionVoList = new ArrayList<>();
                            if (subwayStationList != null && subwayStationList.size() > 0){
                                FilterConditionVo filterCondition = new FilterConditionVo();
                                filterCondition.setSubwayId(999l);
                                filterCondition.setSubwayName("不限");
                                filterConditionVoList.add(filterCondition);
                                for (DicSubwayStation dicSubwayStation : subwayStationList) {
                                    FilterConditionVo filterConditionVo = new FilterConditionVo();
                                    filterConditionVo.setSubwayId(dicSubwayStation.getId());
                                    filterConditionVo.setSubwayName(dicSubwayStation.getStationName());
                                    filterConditionVoList.add(filterConditionVo);
                                }
                            }
                            else {
                                throw new Exception(dicSubway.getSubwayName()+"站点信息为空");
                            }
                            regionalLocationVo.setFilterCondition(filterConditionVoList);
                            regionalLocationVoList.add(regionalLocationVo);
                        }
                    }
                    else {
                        throw new Exception("地铁线路信息为空");
                    }
                    break;

                case "hospital"://医院
                    List<DicLankMark> dicLankMarkList;
                    try {
                        dicLankMarkList = dicLankMarkMapper.hospitalList(cityCountyId);
                    } catch (Exception e){
                        throw new Exception("医院查询失败");
                    }
                    if (dicLankMarkList != null && dicLankMarkList.size() > 0){
                        RegionalLocationVo regionalLocation = new RegionalLocationVo();
                        regionalLocation.setFilterConditionId(999l);
                        regionalLocation.setFilterConditionName("不限");
                        regionalLocationVoList.add(regionalLocation);
                        for (DicLankMark dicLankMark : dicLankMarkList) {
                            RegionalLocationVo regionalLocationVo = new RegionalLocationVo();
                            regionalLocationVo.setFilterConditionId(dicLankMark.getId());
                            regionalLocationVo.setFilterConditionName(dicLankMark.getLandMarkName());
                            regionalLocationVoList.add(regionalLocationVo);
                        }
                    }
                    else {
                        throw new Exception("医院信息为空");
                    }
                    break;

                case "distance"://距离
                    List<DicDistance> dicDistanceList;
                    try {
                        dicDistanceList = dicDistanceMapper.selectDicDistance();
                    } catch (Exception e){
                        throw new Exception("距离信息查询失败");
                    }
                    if (dicDistanceList != null && dicDistanceList.size() > 0){
                        RegionalLocationVo regionalLocation = new RegionalLocationVo();
                        regionalLocation.setFilterConditionId(999l);
                        regionalLocation.setFilterConditionName("不限");
                        regionalLocationVoList.add(regionalLocation);
                        for (DicDistance dicDistance : dicDistanceList) {
                            RegionalLocationVo regionalLocationVo = new RegionalLocationVo();
                            regionalLocationVo.setFilterConditionId(dicDistance.getDistanceId());
                            if (dicDistance.getDistanceName() >= 1000){
                                regionalLocationVo.setFilterConditionName((dicDistance.getDistanceName() / 1000)+"公里内");
                            }
                            else {
                                regionalLocationVo.setFilterConditionName(dicDistance.getDistanceName()+"米内");
                            }

                            regionalLocationVoList.add(regionalLocationVo);
                        }
                    }
                    else {
                        throw new Exception("距离信息为空");
                    }
                    break;

                case "popularArea"://热门区域
                    List<DicHotPosition> dicHotPositionList;
                    try {
                        dicHotPositionList = dicHotPositionMapper.popularAreaList(cityCountyId);
                    } catch (Exception e){
                        throw new Exception("距离信息查询失败");
                    }
                    if (dicHotPositionList != null && dicHotPositionList.size() > 0){
                        RegionalLocationVo regionalLocation = new RegionalLocationVo();
                        regionalLocation.setFilterConditionId(999l);
                        regionalLocation.setFilterConditionName("不限");
                        regionalLocationVoList.add(regionalLocation);
                        for (DicHotPosition dicHotPosition : dicHotPositionList) {
                            RegionalLocationVo regionalLocationVo = new RegionalLocationVo();
                            regionalLocationVo.setFilterConditionId(dicHotPosition.getId());
                            regionalLocationVo.setFilterConditionName(dicHotPosition.getPositionName());
                            regionalLocationVoList.add(regionalLocationVo);
                        }
                    }
                    else {
                        throw new Exception("热门区域信息为空");
                    }
                    break;
                case "serviceFacilities"://服务设施
                    List<DicCommonFacilities> dicCommonFacilities;
                    try {
                        dicCommonFacilities = dicCommonFacilitiesMapper.conditionServiceFacilities();
                    } catch (Exception e){
                        throw new Exception("服务设施查询失败");
                    }
                    if (dicCommonFacilities != null && dicCommonFacilities.size() > 0){
                        RegionalLocationVo regionalLocation = new RegionalLocationVo();
                        regionalLocation.setFilterConditionId(999l);
                        regionalLocation.setFilterConditionName("不限");
                        regionalLocationVoList.add(regionalLocation);
                        for (DicCommonFacilities commonFacilities : dicCommonFacilities) {
                            RegionalLocationVo regionalLocationVo = new RegionalLocationVo();
                            regionalLocationVo.setFilterConditionId(commonFacilities.getId());
                            regionalLocationVo.setFilterConditionName(commonFacilities.getFacilitiesName());
                            regionalLocationVoList.add(regionalLocationVo);
                        }
                    }
                    else {
                        throw new Exception("服务设施信息为空");
                    }
                    break;
                case "hotelType"://酒店类型
                    List<DicHotelType> hotelTypeList;
                    try {
                        hotelTypeList = dicHotelTypeMapper.selectDicHotelType();
                    } catch (Exception e){
                        throw new Exception("酒店类型查询失败");
                    }
                    if (hotelTypeList != null && hotelTypeList.size() > 0){
                        RegionalLocationVo regionalLocation = new RegionalLocationVo();
                        regionalLocation.setFilterConditionId(999l);
                        regionalLocation.setFilterConditionName("不限");
                        regionalLocationVoList.add(regionalLocation);
                        for (DicHotelType dicHotelType : hotelTypeList) {
                            if (dicHotelType.getIsValid() == 1){
                                RegionalLocationVo regionalLocationVo = new RegionalLocationVo();
                                regionalLocationVo.setFilterConditionId(dicHotelType.getHotelTypeId());
                                regionalLocationVo.setFilterConditionName(dicHotelType.getHotelTypeName());
                                regionalLocationVoList.add(regionalLocationVo);
                            }
                        }
                    }
                    else {
                        throw new Exception("酒店类型信息为空");
                    }
                    break;
                case "reviews"://点评
                    List<DicReviews> reviewsList;
                    List<DicReviews> dicReviewsList;
                    int reviewsCount;
                    try {
                        reviewsList = dicReviewsMapper.selectDicReviews();
                        dicReviewsList = dicReviewsMapper.selectReviews();
                    } catch (Exception e){
                        throw new Exception("点评信息查询失败");
                    }
                    if (dicReviewsList != null && dicReviewsList.size() > 0 &&
                            reviewsList != null && reviewsList.size() > 0){
                        for (DicReviews dicReviews : dicReviewsList) {
                            RegionalLocationVo regionalLocationVo = new RegionalLocationVo();
                            List<FilterConditionVo> filterConditionVoList = new ArrayList<>();

                            if (dicReviews.getReviewsType().equals("score") && dicReviews.getReviewsTypeId() == 0){
                                regionalLocationVo.setFilterConditionName("评分");
                                reviewsCount = 1;
                            }
                            else if (dicReviews.getReviewsType().equals("quantity") && dicReviews.getReviewsTypeId() == 1){
                                regionalLocationVo.setFilterConditionName("数量");
                                reviewsCount = 2;
                            }
                            else {
                                throw new Exception("数据有误，请联系相关人员");
                            }

                            FilterConditionVo filterCondition = new FilterConditionVo();
                            filterCondition.setSubwayId(999l);
                            filterCondition.setSubwayName("不限");
                            filterConditionVoList.add(filterCondition);
                            for (DicReviews reviews : reviewsList) {
                                if (reviews.getReviewsType().equals("score") &&
                                        reviews.getReviewsTypeId() == 0 && reviewsCount == 1){
                                    FilterConditionVo filterConditionVo = new FilterConditionVo();
                                    filterConditionVo.setSubwayId(reviews.getReviewsId());
                                    String reviewsName = reviews.getReviewsName() / 10 + "." + reviews.getReviewsName() % 10;
                                    filterConditionVo.setSubwayName(reviewsName);
                                    filterConditionVoList.add(filterConditionVo);
                                }
                                else if (reviews.getReviewsType().equals("quantity") &&
                                        reviews.getReviewsTypeId() == 1 && reviewsCount == 2){
                                    FilterConditionVo filterConditionVo = new FilterConditionVo();
                                    filterConditionVo.setSubwayId(reviews.getReviewsId());
                                    filterConditionVo.setSubwayName(reviews.getReviewsName().toString());
                                    filterConditionVoList.add(filterConditionVo);
                                }
                            }

                            regionalLocationVo.setFilterCondition(filterConditionVoList);
                            regionalLocationVoList.add(regionalLocationVo);
                        }
                    }
                    else {
                        throw new Exception("点评信息为空");
                    }
                    break;
                case "featuredTopics"://特色主题
                    List<DicThems> dicThems;
                    try {
                        dicThems = dicThemsMapper.themsList();
                    } catch (Exception e){
                        throw new Exception("特色主题查询失败");
                    }
                    if (dicThems != null && dicThems.size() > 0){
                        RegionalLocationVo regionalLocation = new RegionalLocationVo();
                        regionalLocation.setFilterConditionId(999l);
                        regionalLocation.setFilterConditionName("不限");
                        regionalLocationVoList.add(regionalLocation);
                        for (DicThems thems : dicThems) {
                            RegionalLocationVo regionalLocationVo = new RegionalLocationVo();
                            regionalLocationVo.setFilterConditionId(thems.getId());
                            regionalLocationVo.setFilterConditionName(thems.getThemesNameCn());
                            regionalLocationVoList.add(regionalLocationVo);
                        }
                    }
                    else {
                        throw new Exception("特色主题信息为空");
                    }
                    break;
                case "roomTypeBreakfast"://房型早餐
                    List<DicRoomTypeBreakast> breakastList;
                    List<DicRoomTypeBreakast> typeBreakastList;
                    int roomCount;
                    try {
                        breakastList = dicRoomTypeBreakastMapper.selectDicRoomTypeBreakast();
                        typeBreakastList = dicRoomTypeBreakastMapper.selectRoomTypeBreakfast();
                    } catch (Exception e){
                        throw new Exception("房型早餐信息查询失败");
                    }
                    if (breakastList != null && breakastList.size() > 0 &&
                            typeBreakastList != null && typeBreakastList.size() > 0){
                        for (DicRoomTypeBreakast dicRoomTypeBreakast : typeBreakastList) {
                            RegionalLocationVo regionalLocationVo = new RegionalLocationVo();
                            List<FilterConditionVo> filterConditionVoList = new ArrayList<>();

                            if (dicRoomTypeBreakast.getRoomTypeBreakfastType().equals("roomType") &&
                                    dicRoomTypeBreakast.getRoomTypeBreakfastTypeId() == 0){
                                regionalLocationVo.setFilterConditionName("房型");
                                roomCount = 1;
                            }
                            else if (dicRoomTypeBreakast.getRoomTypeBreakfastType().equals("breakfast") &&
                                    dicRoomTypeBreakast.getRoomTypeBreakfastTypeId() == 1){
                                regionalLocationVo.setFilterConditionName("早餐");
                                roomCount = 2;
                            }
                            else {
                                throw new Exception("数据有误，请联系相关人员");
                            }

                            FilterConditionVo condition = new FilterConditionVo();
                            condition.setSubwayId(999l);
                            condition.setSubwayName("不限");
                            filterConditionVoList.add(condition);
                            for (DicRoomTypeBreakast roomTypeBreakast : breakastList) {
                                if (roomTypeBreakast.getRoomTypeBreakfastType().equals("roomType") &&
                                        roomTypeBreakast.getRoomTypeBreakfastTypeId() == 0 && roomCount == 1){
                                    FilterConditionVo filterConditionVo = new FilterConditionVo();
                                    filterConditionVo.setSubwayId(roomTypeBreakast.getRoomTypeBreakfastId());
                                    filterConditionVo.setSubwayName(roomTypeBreakast.getRoomTypeBreakfastName());
                                    filterConditionVoList.add(filterConditionVo);
                                }
                                else if (roomTypeBreakast.getRoomTypeBreakfastType().equals("breakfast") &&
                                        roomTypeBreakast.getRoomTypeBreakfastTypeId() == 1 && roomCount == 2){
                                    FilterConditionVo filterConditionVo = new FilterConditionVo();
                                    filterConditionVo.setSubwayId(roomTypeBreakast.getRoomTypeBreakfastId());
                                    filterConditionVo.setSubwayName(roomTypeBreakast.getRoomTypeBreakfastName());
                                    filterConditionVoList.add(filterConditionVo);
                                }
                            }

                            regionalLocationVo.setFilterCondition(filterConditionVoList);
                            regionalLocationVoList.add(regionalLocationVo);
                        }
                    }
                    else {
                        throw new Exception("房型早餐信息为空");
                    }
                    break;
            }
        }
        else {
            throw new Exception("城市id格式错误");
        }
        return regionalLocationVoList;
    }
}
